// 市场销售 / 排班管理

import r from '@/utils/request'
import { type ListResponseType, type ResponseType } from '../types'

enum API {
    scheduleList = "/schedule/list", // 排班列表
    scheduleAdd = "/schedule/add", // 排班添加
    scheduleDelete = "/schedule/delete", // 排班删除
}

export interface scheduleListResAPI {
    id:         number;
    elderlyId:  number;
    day:        string;
    week:       string;
    staffId:    number;
    staffName:  string;
    staffPhoto: string;
}

export function getscheduleListAPI(id:number):Promise<ListResponseType<scheduleListResAPI>> {
    return r.get(API.scheduleList+'/'+id)
}

export interface  scheduleAddParams {
    elderlyId: number;
    day:       string;
    week:      string;
    staffId:   number;
}

export interface scheduleAddResAPI {
    id:         number;
    elderlyId:  number;
    day:        string;
    week:       string;
    staffId:    number;
    staffName:  string;
    staffPhoto: string;
}

export function scheduleAddAPI(Params:scheduleAddParams):Promise<ResponseType<scheduleAddResAPI>> {
    return r.post(API.scheduleAdd,Params)
}

export function scheduleDeleteAPI(id:number):Promise<ResponseType<null>> {
    return r.delete(API.scheduleDelete+'/'+id)
}